home *** CD-ROM | disk | FTP | other *** search
/ PC Users 1998 June / Cd Pc Users 9.iso / prog / inst / ftpx / ftpx.exe / FTPMAIN.FRM (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1997-08-25  |  9.6 KB  |  305 lines

  1. VERSION 4.00
  2. Begin VB.MDIForm MainForm 
  3.    BackColor       =   &H00C0C0C0&
  4.    Caption         =   "Mabry FTP Sample Program"
  5.    ClientHeight    =   8460
  6.    ClientLeft      =   3570
  7.    ClientTop       =   1425
  8.    ClientWidth     =   9105
  9.    Height          =   8865
  10.    Left            =   3510
  11.    LinkTopic       =   "MDIForm1"
  12.    Top             =   1080
  13.    Width           =   9225
  14.    Begin VB.PictureBox Picture3 
  15.       Align           =   2  'Align Bottom
  16.       Height          =   375
  17.       Left            =   0
  18.       ScaleHeight     =   315
  19.       ScaleWidth      =   9045
  20.       TabIndex        =   9
  21.       Top             =   8085
  22.       Width           =   9105
  23.       Begin VB.Label Label7 
  24.          Height          =   180
  25.          Left            =   7695
  26.          TabIndex        =   17
  27.          Top             =   60
  28.          Width           =   1110
  29.       End
  30.       Begin VB.Label Label6 
  31.          Alignment       =   1  'Right Justify
  32.          Caption         =   "Progress:"
  33.          Height          =   165
  34.          Left            =   6735
  35.          TabIndex        =   16
  36.          Top             =   60
  37.          Width           =   855
  38.       End
  39.       Begin VB.Label Label5 
  40.          Alignment       =   1  'Right Justify
  41.          Caption         =   "State:"
  42.          Height          =   255
  43.          Left            =   1380
  44.          TabIndex        =   15
  45.          Top             =   60
  46.          Width           =   615
  47.       End
  48.       Begin VB.Label Label4 
  49.          Alignment       =   1  'Right Justify
  50.          Caption         =   "Last Error:"
  51.          Height          =   255
  52.          Left            =   2580
  53.          TabIndex        =   14
  54.          Top             =   60
  55.          Width           =   855
  56.       End
  57.       Begin VB.Label Label3 
  58.          Alignment       =   1  'Right Justify
  59.          Caption         =   "Last Action:"
  60.          Height          =   255
  61.          Left            =   60
  62.          TabIndex        =   13
  63.          Top             =   60
  64.          Width           =   855
  65.       End
  66.       Begin VB.Label lblState 
  67.          Caption         =   "Label2"
  68.          Height          =   255
  69.          Left            =   2100
  70.          TabIndex        =   12
  71.          Top             =   60
  72.          Width           =   615
  73.       End
  74.       Begin VB.Label lblLastError 
  75.          Caption         =   "Label2"
  76.          Height          =   255
  77.          Left            =   3540
  78.          TabIndex        =   11
  79.          Top             =   60
  80.          Width           =   975
  81.       End
  82.       Begin VB.Label lblLastAction 
  83.          Caption         =   "Label2"
  84.          Height          =   255
  85.          Left            =   1020
  86.          TabIndex        =   10
  87.          Top             =   60
  88.          Width           =   375
  89.       End
  90.    End
  91.    Begin VB.PictureBox Picture2 
  92.       Align           =   1  'Align Top
  93.       Height          =   435
  94.       Left            =   0
  95.       ScaleHeight     =   375
  96.       ScaleWidth      =   9045
  97.       TabIndex        =   3
  98.       Top             =   3975
  99.       Width           =   9105
  100.       Begin VB.Timer Timer1 
  101.          Interval        =   1
  102.          Left            =   6360
  103.          Top             =   0
  104.       End
  105.       Begin VB.CommandButton cmdFileTransfers 
  106.          Caption         =   "File Transfers"
  107.          Height          =   375
  108.          Left            =   2670
  109.          TabIndex        =   6
  110.          Top             =   0
  111.          Width           =   1335
  112.       End
  113.       Begin VB.CommandButton cmdDirectory 
  114.          Caption         =   "Directory"
  115.          Height          =   375
  116.          Left            =   1335
  117.          TabIndex        =   5
  118.          Top             =   0
  119.          Width           =   1335
  120.       End
  121.       Begin VB.CommandButton cmdConnection 
  122.          Caption         =   "Connection"
  123.          Height          =   375
  124.          Left            =   0
  125.          TabIndex        =   4
  126.          Top             =   0
  127.          Width           =   1335
  128.       End
  129.       Begin MabryFtp.mFtp Ftp1 
  130.          Left            =   4800
  131.          Top             =   0
  132.          _ExtentX        =   847
  133.          _ExtentY        =   847
  134.          DebugMode       =   1
  135.          DisablePasv     =   0   'False
  136.       End
  137.    End
  138.    Begin VB.PictureBox Picture1 
  139.       Align           =   1  'Align Top
  140.       Height          =   3975
  141.       Left            =   0
  142.       ScaleHeight     =   3915
  143.       ScaleWidth      =   9045
  144.       TabIndex        =   0
  145.       Top             =   0
  146.       Width           =   9105
  147.       Begin VB.ListBox listTrace 
  148.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  149.             Name            =   "Courier New"
  150.             Size            =   8.25
  151.             Charset         =   0
  152.             Weight          =   400
  153.             Underline       =   0   'False
  154.             Italic          =   0   'False
  155.             Strikethrough   =   0   'False
  156.          EndProperty
  157.          Height          =   1110
  158.          Left            =   120
  159.          TabIndex        =   2
  160.          Top             =   360
  161.          Width           =   7935
  162.       End
  163.       Begin VB.ListBox listDir 
  164.          BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851} 
  165.             Name            =   "Courier New"
  166.             Size            =   8.25
  167.             Charset         =   0
  168.             Weight          =   400
  169.             Underline       =   0   'False
  170.             Italic          =   0   'False
  171.             Strikethrough   =   0   'False
  172.          EndProperty
  173.          Height          =   1950
  174.          Left            =   120
  175.          TabIndex        =   1
  176.          Top             =   1800
  177.          Width           =   7935
  178.       End
  179.       Begin VB.Label Label2 
  180.          Caption         =   "Dir List:"
  181.          Height          =   255
  182.          Left            =   120
  183.          TabIndex        =   8
  184.          Top             =   1560
  185.          Width           =   855
  186.       End
  187.       Begin VB.Label Label1 
  188.          Caption         =   "Trace:"
  189.          Height          =   255
  190.          Left            =   120
  191.          TabIndex        =   7
  192.          Top             =   120
  193.          Width           =   975
  194.       End
  195.    End
  196. Attribute VB_Name = "MainForm"
  197. Attribute VB_Creatable = False
  198. Attribute VB_Exposed = False
  199. Option Explicit
  200. Dim frmLoaded As Form
  201. Dim cmdCurrent As CommandButton
  202. Dim fIgnoreListDirClick As Boolean
  203. Public Function ExecuteCommand(action As Integer) As Integer
  204.     On Error Resume Next
  205.     Ftp1.action = action
  206.     If (Err <> 0) Then
  207.         MsgBox Error
  208.     End If
  209.     ExecuteCommand = Err
  210.     On Error GoTo 0
  211. End Function
  212. Sub LoadForm(frmNew As Form, cmdNew As CommandButton)
  213.     If (frmNew Is frmLoaded) Then
  214.         Exit Sub
  215.     End If
  216.     frmNew.Top = 0
  217.     frmNew.Left = 0
  218.     Load frmNew
  219.     frmNew.Show
  220.     If (Not frmLoaded Is Nothing) Then
  221.         frmLoaded.Visible = False
  222.         cmdCurrent.FontBold = False
  223.     End If
  224.     cmdNew.FontBold = True
  225.     Set frmLoaded = frmNew
  226.     Set cmdCurrent = cmdNew
  227. End Sub
  228. Private Sub cmdConnection_Click()
  229.     LoadForm frmConnection, cmdConnection
  230. End Sub
  231. Private Sub cmdDirectory_Click()
  232.     LoadForm frmDirectory, cmdDirectory
  233. End Sub
  234. Private Sub cmdFileTransfers_Click()
  235.     LoadForm frmFileTransfers, cmdFileTransfers
  236. End Sub
  237. Private Sub Ftp1_Progress(ByVal BytesTransfered As Long)
  238.     Label7.Caption = BytesTransfered
  239. End Sub
  240. Private Sub listDir_Click()
  241.     Dim s As String
  242.     Dim i As Integer
  243.        
  244.     If (fIgnoreListDirClick = True Or listDir.ListIndex < 0) Then
  245.         Exit Sub
  246.     End If
  247.     s = listDir.list(listDir.ListIndex)
  248.     i = Len(s)
  249.     Do While (i > 1)
  250.         If (Mid(s, i, 1) = " ") Then
  251.             Debug.Print Mid(s, i + 1)
  252.             SetSelectedServerFile Mid(s, i + 1)
  253.             If (Left(s, 1) = "d" Or Left(s, 1) = "l") Then
  254.                 If (frmLoaded Is frmDirectory) Then
  255.                     frmDirectory.txtDirectory.Text = GetSelectedServerFile
  256.                 ElseIf (frmLoaded Is frmFileTransfers) Then
  257.                     frmFileTransfers.txtGetSrcFilename.Text = ""
  258.                 End If
  259.             Else
  260.                 If (frmLoaded Is frmDirectory) Then
  261.                     frmDirectory.txtDirectory.Text = ""
  262.                 ElseIf (frmLoaded Is frmFileTransfers) Then
  263.                     frmFileTransfers.txtGetSrcFilename.Text = GetSelectedServerFile
  264.                 End If
  265.             End If
  266.             Exit Sub
  267.         End If
  268.         i = i - 1
  269.     Loop
  270. End Sub
  271. Private Sub MDIForm_Load()
  272.     DoEvents
  273.     Ftp1.Type = 0
  274.     LoadForm frmConnection, cmdConnection
  275. End Sub
  276. Private Sub Ftp1_AsyncError(ByVal ErrorNum As Long, ByVal ErrorMsg As String)
  277.     Trace MainForm.listTrace, "Async Error:" & Str(ErrorNum) & " " & ErrorMsg
  278. End Sub
  279. Private Sub Ftp1_Debug(ByVal DebugMsg As String)
  280.     If (Ftp1.action <> FtpActionGetDirList And Ftp1.action <> FtpActionGetFilenameList) Then
  281.         Trace MainForm.listTrace, DebugMsg
  282.     End If
  283.     Debug.Print DebugMsg
  284. End Sub
  285. Private Sub Ftp1_DirItem(ByVal Item As String)
  286.     fIgnoreListDirClick = True
  287.     Trace MainForm.listDir, Item
  288.     fIgnoreListDirClick = False
  289. End Sub
  290. Private Sub Ftp1_Done()
  291.     Trace MainForm.listTrace, "done event fired"
  292.     If (Ftp1.action = 22) Then
  293.         Trace MainForm.listTrace, Ftp1.ReadData
  294.     End If
  295. End Sub
  296. Private Sub MDIForm_Resize()
  297.     listTrace.Width = Me.ScaleWidth - (2 * listTrace.Left)
  298.     listDir.Width = listTrace.Width
  299. End Sub
  300. Private Sub Timer1_Timer()
  301.     lblLastAction.Caption = Ftp1.action
  302.     lblLastError.Caption = Ftp1.LastError
  303.     lblState.Caption = Ftp1.State
  304. End Sub
  305.